package com.ssy.lingxi.product.common.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 审核状态
 * @author jw.chen
 * @version 2.0.0
 * @date 2022/3/3
 */
public enum CheckStatusEnum {
    DEFAULT(-1,""),
    AGREE(1, "通过"),
    REFUSE(0, "不通过");

    private final Integer code;
    private final String message;

    CheckStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        CheckStatusEnum statusEnum = Arrays.stream(CheckStatusEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(CheckStatusEnum.class, statusEnum.getCode());
    }
}
